package com.lion.hbase.model;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.lion.hbase.annotation.HField;
import com.lion.hbase.annotation.HTable;

@HTable(name = "ReportKeyword", family = "DATA")
public class ReportKeyword extends ReportCampaign {
	@HField("ADGROUP")
	private String adGroup;
	@HField("ADGROUP_ID")
	private Long adGroupId;
	@HField("CLICKS")
	private Integer clicks;
	@HField(value = "COST")
	private Double cost;
	@HField("KEYWORD")
	private String keyword;
	@HField("KEYWORD_ID")
	private Long keywordId;

	@Override
	public byte[] getKey() {
		StringBuilder sb = new StringBuilder();
		sb.append(getNetwork()).append(getCustomerId())
				.append(new SimpleDateFormat("yyMMdd").format(getDate()))
				.append(getCampaignId()).append(adGroupId).append(keywordId);
		return sb.toString().getBytes();
	}

	public ReportKeyword() {

	}

	public ReportKeyword(String network, Long customerId, Date date,
			Long campaignId, Long adGroupId, Long keywordId) {
		setNetwork(network);
		setCustomerId(customerId);
		setDate(date);
		setCampaignId(campaignId);
		this.adGroupId = adGroupId;
		this.keywordId = keywordId;
	}

	public String getAdGroup() {
		return adGroup;
	}

	public void setAdGroup(String adGroup) {
		this.adGroup = adGroup;
	}

	public Long getAdGroupId() {
		return adGroupId;
	}

	public void setAdGroupId(Long adGroupId) {
		this.adGroupId = adGroupId;
	}

	public Integer getClicks() {
		return clicks;
	}

	public void setClicks(Integer clicks) {
		this.clicks = clicks;
	}

	public Double getCost() {
		return cost;
	}

	public void setCost(Double cost) {
		this.cost = cost;
	}

	public String getKeyword() {
		return keyword;
	}

	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	public Long getKeywordId() {
		return keywordId;
	}

	public void setKeywordId(Long keywordId) {
		this.keywordId = keywordId;
	}

	@Override
	public String toString() {
		return "ReportKeyword [adGroup=" + adGroup + ", adGroupId=" + adGroupId
				+ ", clicks=" + clicks + ", cost=" + cost + ", keyword="
				+ keyword + ", keywordId=" + keywordId + ", getCampaign()="
				+ getCampaign() + ", getCampaignId()=" + getCampaignId()
				+ ", getNetwork()=" + getNetwork() + ", getCustomerId()="
				+ getCustomerId() + ", getDate()=" + getDate() + "]";
	}



}
